package com.xhh.nphm.framework.datasource;

/**
 * @description: 线程安全类，存放数据源
 * @author: sun
 * @date: 2023-12-24 10:28
 * @version 1.0
 */
public class DataBaseContextHolder {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();

    /**
     * 放入
     * @param type
     */
    public static void setDataBase(String type){
        contextHolder.set(type);
    }

    /**
     * 获取
     */
    public static String getDataBase(){
        return contextHolder.get();
    }

    /**
     * 清空
     */
    public static void chearDataSource(){
        contextHolder.remove();
    }
}

